<?php
/**
 * BaseController - The Base Controller
 * 
 * @author Ufuk Bozdemir
 * @version 
 */

class BaseController extends Zend_Controller_Action
{
	public function init()
	{
		// Use this to add javascript files and stylesheets and will get called from the main layout.
		//$this->view->headScript()->appendFile('');
		$this->view->headLink()->appendStylesheet(Initializer::initPhpConfig()->stylesheet->default);
	}
	
	protected function _generateToken($seed = '68sNnx6l')
	{
		return Initializer::generateToken($seed);
	}
	
	protected function _tokenCheck($tokenToCheck = '')
	{
		$globalSession = new Zend_Session_Namespace('global');
		$returnValue = (!empty($tokenToCheck) and $tokenToCheck == $globalSession->token);
		return $returnValue;
	}
	
	protected function _tokenPost()
	{
		// Get the token check
		$token = Zend_Filter::get($this->getRequest()->getPost('token'), 'StripTags');
		
		// Execute the token
		$this->_generateToken();
	}
}

?>